package 第三天

fun main(args: Array<String>) {
    //主构造函数
    val person1 = Person6("fasd", 23)
    val person2 = Person6("fasf", 32, "121331")
    person1.name = "张三"

    //次构造函数的访问
    person2.phone = "7084708970"
    println(person2.phone)
}


class Person6(var name: String, var age: Int) {
    var phone = ""
    //次构造函数
    constructor(name: String, age: Int, phone: String) : this(name, age) {    // this(name,age) 表示调用当前的主构造函数
        this.phone = phone

    }
}